<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  
  <title>Kross | gdme1320 的笔记</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Table of Contents   Introduction  What Kross is What Kross is not Reuse and choice are the goals Supported interpreters Advantage of Kross over other solutions   The Interpreter plugins  Python Rub">
<meta property="og:type" content="article">
<meta property="og:title" content="Kross">
<meta property="og:url" content="http://gdme1320.gitee.com/linux/kross/kross/index.html">
<meta property="og:site_name" content="gdme1320 的笔记">
<meta property="og:description" content="Table of Contents   Introduction  What Kross is What Kross is not Reuse and choice are the goals Supported interpreters Advantage of Kross over other solutions   The Interpreter plugins  Python Rub">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2022-03-23T09:59:41.859Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Kross">
<meta name="twitter:description" content="Table of Contents   Introduction  What Kross is What Kross is not Reuse and choice are the goals Supported interpreters Advantage of Kross over other solutions   The Interpreter plugins  Python Rub">
  
    <link rel="alternate" href="/atom.xml" title="gdme1320 的笔记" type="application/atom+xml">
  
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" integrity="sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+" crossorigin="anonymous">

  <link rel="stylesheet" href="/css/styles.css">
  <link rel="stylesheet" href="/css/docs.min.css">
  

</head>
</html>
<body>
  <nav class="navbar navbar-inverse">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-menu-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="main-menu-navbar">
      <ul class="nav navbar-nav">
        
          <li><a class href="/index.html">Home</a></li>
        
          <li><a class href="/archives/">Archives</a></li>
        
      </ul>

      <!--
      <ul class="nav navbar-nav navbar-right">
        
          <li><a href="/atom.xml" title="RSS Feed"><i class="fa fa-rss"></i></a></li>
        
      </ul>
      -->
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

  <div class="container bs-docs-container">
  
    <div class="row">
        <div class="col-sm-8 blog-main">
          <article id="post-linux/kross/kross" class="article article-type-post" itemscope itemprop="blogPost">

  <header class="article-header">
    
  
    <h1 class="article-title" itemprop="name">
      Kross
    </h1>
  


  </header>

  <div class="article-meta">
    <div class="article-datetime">
  <a href="/linux/kross/kross/" class="article-date"><time datetime="2020-06-02T16:00:00.000Z" itemprop="datePublished">2020-06-03</time></a>
</div>

    
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a> / <a class="article-category-link" href="/categories/linux/kross/">kross</a>
  </div>


  </div>
  <div class="article-inner">

    <div class="article-entry" itemprop="articleBody">
      
        
<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org93e97bf">Introduction</a>
<ul>
<li><a href="#orgeff3bdf">What Kross is</a></li>
<li><a href="#orgf2670c3">What Kross is not</a></li>
<li><a href="#org6f42a32">Reuse and choice are the goals</a></li>
<li><a href="#org17e0dcf">Supported interpreters</a></li>
<li><a href="#org876b589">Advantage of Kross over other solutions</a></li>
</ul>
</li>
<li><a href="#orgbc290a5">The Interpreter plugins</a>
<ul>
<li><a href="#org83df130">Python</a></li>
<li><a href="#orgcb0019d">Ruby</a></li>
<li><a href="#org33c5f77">JavaScript</a></li>
<li><a href="#orgcce34e6">Java</a></li>
<li><a href="#orga9e56f2">Falcon</a></li>
</ul>
</li>
<li><a href="#org87b91ac">The Module plugins</a></li>
<li><a href="#org6ddb8b4">Manager, GuiClient, Action</a></li>
<li><a href="#org2d54a61">D-Bus and Kross</a></li>
</ul>
</div>
</div>
<blockquote>
<p>
<a href="https://techbase.kde.org/Development/Tutorials/Kross/Introduction" target="_blank" rel="noopener">https://techbase.kde.org/Development/Tutorials/Kross/Introduction</a>
</p>
</blockquote>
<div class="outline-2" id="outline-container-org93e97bf">
<h2 id="org93e97bf">Introduction</h2>
<div class="outline-text-2" id="text-org93e97bf">
<p>
The Kross scripting framework provides full Python, Ruby and KDE JavaScript scripting support. The goal was to limit the work needed on applications to have them fully scriptable and to provide a modular way to transparently integrate additional interpreters and in that way extend your application with a new scripting-backend without any new line of code and even without any recompile. To achieve this internally Qt's introspection-functionality like signals, slots, properties, enums, QVariant, QObject, QMetaObject, QMetaType, etc. are used to deal with functionality at runtime.
</p>
</div>
<div class="outline-3" id="outline-container-orgeff3bdf">
<h3 id="orgeff3bdf">What Kross is</h3>
<div class="outline-text-3" id="text-orgeff3bdf">
<p>
Kross is a modular scripting framework that eases embedding of scripting interpreters like Python, Ruby and JavaScript transparently into native applications to bridge the static and dynamic worlds together.
</p>
<p>
Scripting interpreters are plugins that are loaded dynamically on demand at runtime by the Kross framework. The application that uses Kross to provide scripting functionality to the user does not need to know anything about the interpreter, itself or any other backend-details. All the application needs to know is that there exists scripting code that should be executed. Kross will then take care of it. 
</p>
</div>
</div>
<div class="outline-3" id="outline-container-orgf2670c3">
<h3 id="orgf2670c3">What Kross is not</h3>
<div class="outline-text-3" id="text-orgf2670c3">
<p>
Kross does not implement its own scripting language, rather, it provides access to already existing solutions. Kross does not implement a complete Toolkit-binding, rather, it provides access to already existing solutions like PyQt/PyKDE or TkInter for Python or Korundum/QtRuby for Ruby. Kross does not auto-generate code, it is not needed to maintain any configuration files, and it does not come with yet another bindings-API. All it does is to connect things transparently together and to offer optional access to already existing technologies. 
</p>
</div>
</div>
<div class="outline-3" id="outline-container-org6f42a32">
<h3 id="org6f42a32">Reuse and choice are the goals</h3>
<div class="outline-text-3" id="text-org6f42a32">
<p>
There exists a wide range of solutions to deal with scripting. Programming languages like Python have enjoyed years of evolution and a large community around them with 3rd-party modules for nearly everything. The same goes for a lot of other languages where there sometimes exists a special function that is only available to a particular language, and where each language comes with its own way of doing things. Each user may have their own preference for what scripting language they like to use, and over time, may have acquired skills in some specific areas.
</p>
<p>
Rather than limiting users to only one specific language with its own way of doing things, Kross offers a flexible way of supporting multiple programming languages without additional code and maintenance work, at the application level. Kross allows the user to choose what they like and know the most, and it minimizes the entry-barrier to get his things done and to be able to contribute to one's own solutions significantly. 
</p>
</div>
</div>
<div class="outline-3" id="outline-container-org17e0dcf">
<h3 id="org17e0dcf">Supported interpreters</h3>
<div class="outline-text-3" id="text-org17e0dcf">
<p>
As of today Python, Ruby and JavaScript are supported. While all of them are passing the unittests, current state is, that Python is the most complete one followed by Ruby which is near the same state and finally JavaScript which needs some more tweaks to be as rock-stable as the other both implementations.
</p>
<p>
Work on progress are krossjava (thanks to google for supporting this plugin within the Google Summer of Code 2007) that implements support for the Java Virtual Machine and krossfalcon that implements support for The Falcon Programming Language.
</p>
<p>
For sure any interpreter-plugin you may like to implement is very welcome. At the end the open source world is about choices :) 
</p>
</div>
</div>
<div class="outline-3" id="outline-container-org876b589">
<h3 id="org876b589">Advantage of Kross over other solutions</h3>
<div class="outline-text-3" id="text-org876b589">
<ul class="org-ul">
<li>Scripting interpreter independent. Kross does not implement an interpreter, it provides access to already existing interpreters. You don't limit your users to a particular scripting language, each user is free to decide which scripting language is best suited.</li>
<li>Real embedding. Rather then communicating with scripting backends e.g. over stdin/stdout or D-Bus Kross does come with plugins that really embed the interpreters and deal with them on the native C/C++ code level to gain optimal performance and flexibility.</li>
<li>Kross is fast. Kross had a bit of luck to be adopted by Krita so early since one of the top-priorities Krita had on a scripting backend was performance. During the years we managed to increase the speed to a level where it's hard to see a difference to native in C/C++ written code.</li>
<li>Kross is platform-independent. From the beginning Kross was designed with platform-independence in mind. This is the result of the origins of Kross - it started as Kexi plugin, and Kexi itself runs at least on Linux, Windows and Mac since its early days.</li>
<li>Kross is stable and well proven. Before Kross finally landed in kdelibs it was in use in KOffice for 3 major releases and was thus "tested" by a wide range of users worldwide.</li>
<li>A lot of documentation, scripts and applications are using Kross already today. The latter guarantees that Kross offers the solution for many scenarios.</li>
<li>Kross can be easily extended with a new scripting interpreter. There are no changes needed to the applications. So, whatever hype we are able to see in the next few years, we are ready to fullfit the possible user-requests for them without much pain.</li>
<li>Kross benefits from applications. The synergy-effect if multiple applications are sharing the same interpreter plugin implementations ensures that bugs are discovered and fixed as soon as possible. Also each app is able to profit if someone writes for example a plugin for the LUA-interpreter each app is able to use the new backend without any recompile.</li>
<li>Kross reuses existing technologies as much as possible. There is no need for code-generation at compile time and no new "bindings API" is introduced since we are reusing the Qt Meta-Object System. You are able to throw in a QObject and a script is able to connect with the signals, call slots as there are functions, access enumerations, get/set properties or pass QObject/QWidget instances around as there are classes.</li>
<li>The interpreter backend is very flexible. Each interpreter's plugin is able to decide on its own how to implement the bridging functionality. If you like for example to have it more "pythonic" by using the decorators introduced in Python 2.4, you are free to implement it and each app that uses Kross will profit by beeing able to use such decorators from now on.</li>
<li>Kross will stay backward-compatible. Kross is part of kdelibs and thus follows strict policies to provide backward-compatibility at least during the lifetime of KDE4.</li>
</ul>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-orgbc290a5">
<h2 id="orgbc290a5">The Interpreter plugins</h2>
<div class="outline-text-2" id="text-orgbc290a5">
<p>
Kross offers a plugin interface to integrate interpreter backends like Python, Ruby and KDE-Javascript. They are loaded on demand at runtime. Neither the application nor Kross needs to know any details about the backends. This clear separation between the application and scripting details enables at the one hand, to deal with scripting at an abstract level without being bound to only one backend, and at the other hand makes it easy to integrate scripting into an already existing application.
</p>
<p>
Each interpreter plugin needs to implement two abstract classes;
</p>
<ul class="org-ul">
<li>The Kross::Interpreter class is a singleton controlled by the Kross::Manager and could be used to setup the interpreter or do other things to share functionality between instances of the Script class.</li>
<li>The Kross::Script class handles exactly one script instance. An application is able to deal with multiple scripts at the same time where each of them has its own instance of the Kross::Script class controlled by an instance of the more abstract Kross::Action class.</li>
</ul>
</div>
<div class="outline-3" id="outline-container-org83df130">
<h3 id="org83df130">Python</h3>
<div class="outline-text-3" id="text-org83df130">
<p>
The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/" target="_blank" rel="noopener">Python plugin</a> implements access to the Python scripting language.
</p>
<p>
The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/unittest.py" target="_blank" rel="noopener">unittest.py</a> Python script file implements unittests for common functionality. For the unittests kross does use a special test-application that got compiled if cmake -DKDE4_BUILD_TESTS=1 was used for kdelibs. You are able to run the unittest with
</p>
<pre class="example">
cd kdelibs/kross/test
./krosstest unittest.py
</pre>
<p>
Other scripts are…
</p>
<ul class="org-ul">
<li>The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/testkross.py" target="_blank" rel="noopener">testkross.py</a> Python script file demonstrates how to use Kross to execute some JavaScript code within a python script.</li>
<li>The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/testguitk.py" target="_blank" rel="noopener">testguitk.py</a> Python script file that creates and displays a modal dialog using the TkInter GUI-toolkit.</li>
<li>The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/testguiqt.py" target="_blank" rel="noopener">testguiqt.py</a> Python script file shows how to use PyQt while the <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/testguiform.py" target="_blank" rel="noopener">testguiform.py</a> uses the Kross Form module.</li>
</ul>
<p>
The krosspython plugin consists of…
</p>
<ul class="org-ul">
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythoninterpreter.h" target="_blank" rel="noopener">Kross::PythonInterpreter</a> class implements <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/coreinterpreter.h" target="_blank" rel="noopener">Kross::Interpreter</a> for the Python interpreter backend and implements the createScript factory method to create <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonscript.h" target="_blank" rel="noopener">Kross::PythonScript</a> instances.</li>
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonscript.h" target="_blank" rel="noopener">Kross::PythonScript</a> class implements <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/corescript.h" target="_blank" rel="noopener">Kross::Script</a> for the Python backend to provide the functionality to execute Python code within a script-container.</li>
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonmodule.h" target="_blank" rel="noopener">Kross::PythonModule</a> class is the <span class="underline"><span class="underline">main</span></span> Python environment used as global object namespace. This module is shared between the different <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonscript.h" target="_blank" rel="noopener">Kross::PythonScript</a> instances which run in there own module namespace. The Kross::PythonModule also spends access to the the whole Kross functionality and manages all the @a Kross::PythonExtension modules.</li>
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonextension.h" target="_blank" rel="noopener">Kross::PythonExtension</a> class implements a Py::Object to wrap a QObject instance into the world of Python.</li>
<li>Within <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonvariant.h" target="_blank" rel="noopener">Kross::PythonVariant</a> the Kross::PythonType helper class is used to cast between QVariant and Py::Object values while the Kross::PythonMetaTypeFactory helper class is used as factory within <a href="http://websvn.kde.org/trunk/KDE/kdebindings/python/krosspython/pythonextension.h" target="_blank" rel="noopener">Kross::PythonExtension</a> to translate an argument into a Kross::MetaType needed for QGenericArgument's data pointer.</li>
</ul>
</div>
</div>
<div class="outline-3" id="outline-container-orgcb0019d">
<h3 id="orgcb0019d">Ruby</h3>
<div class="outline-text-3" id="text-orgcb0019d">
<p>
The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/" target="_blank" rel="noopener">Ruby plugin</a> implements access to the <a href="http://www.ruby-lang.org/" target="_blank" rel="noopener">Ruby</a> scripting language.
The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/unittest.rb" target="_blank" rel="noopener">unittest.rb</a> Ruby script file implements unittests for common functionality. For the unittests <b>kross</b> does use a special test-application that got compiled if cmake -DKDE4_BUILD_TESTS=1 was used for kdelibs. You are able to run the unittest with
</p>
<pre class="example">
cd kdelibs/kross/test
./krosstest unittest.rb
</pre>
<p>
The krossruby plugin consists of…
</p>
<ul class="org-ul">
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyinterpreter.h" target="_blank" rel="noopener"><b>Kross</b>::RubyInterpreter</a> class implements <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/coreinterpreter.h" target="_blank" rel="noopener"><b>Kross</b>::Interpreter</a> for the Ruby interpreter backend and provides with the createScript a factory method to create <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyscript.h" target="_blank" rel="noopener"><b>Kross</b>::RubyScript</a> instances.</li>
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyscript.h" target="_blank" rel="noopener"><b>Kross</b>::RubyScript</a> class implements <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/corescript.h" target="_blank" rel="noopener"><b>Kross</b>::Script</a> for the Ruby backend to provide the functionality to execute Ruby code within a script-container.</li>
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubymodule.h" target="_blank" rel="noopener"><b>Kross</b>::RubyModule</a> class is the <span class="underline"><span class="underline">main</span></span> Ruby environment used as global object namespace. This module is shared between the different <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyscript.h" target="_blank" rel="noopener"><b>Kross</b>::RubyScript</a> instances which run in there own module namespace. The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubymodule.h" target="_blank" rel="noopener"><b>Kross</b>::RubyModule</a> also spends access to the the whole <b>Kross</b> functionality and manages all the @a <b>Kross</b>::RubyExtension modules.</li>
<li>The <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyextension.h" target="_blank" rel="noopener"><b>Kross</b>::RubyExtension</a> class implements a Ruby VALUE object to wrap a QObject instance into the world of Ruby.</li>
<li>Within <a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyvariant.h" target="_blank" rel="noopener"><b>Kross</b>::RubyVariant</a> the <b>Kross</b>::RubyType helper class is used to cast between QVariant and Ruby VALUE values while the <b>Kross</b>::RubyMetaTypeFactory helper class is used as factory within
<a href="http://websvn.kde.org/trunk/KDE/kdebindings/ruby/krossruby/rubyextension.h" target="_blank" rel="noopener"><b>Kross</b>::RubyExtension</a> to translate an argument into a <b>Kross</b>::MetaType needed for QGenericArgument's data pointer.</li>
</ul>
</div>
</div>
<div class="outline-3" id="outline-container-org33c5f77">
<h3 id="org33c5f77">JavaScript</h3>
<div class="outline-text-3" id="text-org33c5f77">
<p>
The
<a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/kjs" target="_blank" rel="noopener">KDE
JavaScript plugin</a> uses the in kdelibs4 included Kjs and KjsEmbed4
frameworks to provide access to the JavaScript language.
The
<a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/test/unittest.js" target="_blank" rel="noopener">unittest.js</a>
KDE-JavaScript script file implements unittests for common
functionality. For the unittests <b>kross</b> does use a special
test-application that got compiled if cmake -DKDE4_BUILD_TESTS=1 was
used for kdelibs. You are able to run the unittest with
</p>
<pre class="example">
cd kdelibs/kross/test
./krosstest unittest.js
</pre>
<p>
For details about KDE-JavaScript see…
</p>
<ul class="org-ul">
<li><a href="http://websvn.kde.org/trunk/KDE/kdelibs/kjs/README" target="_blank" rel="noopener">Kjs readme</a></li>
<li><a href="http://websvn.kde.org/trunk/KDE/kdelibs/kjs/" target="_blank" rel="noopener">Kjs svn</a></li>
<li><a href="http://xmelegance.org/kjsembed" target="_blank" rel="noopener">KjsEmbed home</a></li>
<li><a href="https://mail.kde.org/mailman/listinfo/kjsembed" target="_blank" rel="noopener">KjsEmbed
mailinglist</a></li>
<li><a href="http://websvn.kde.org/trunk/KDE/kdelibs/kjsembed/" target="_blank" rel="noopener">KjsEmbed svn</a></li>
</ul>
</div>
</div>
<div class="outline-3" id="outline-container-orgcce34e6">
<h3 id="orgcce34e6">Java</h3>
<div class="outline-text-3" id="text-orgcce34e6">
<p>
The <a href="file:///Projects/Summer_of_Code/2007/Projects/KrossJava" target="_blank" rel="noopener">Google Summer of Code 2007</a> did provide us the <a href="http://websvn.kde.org/trunk/KDE/kdebindings/java/krossjava/" target="_blank" rel="noopener">krossjava</a> backend for Java :-)
</p>
</div>
</div>
<div class="outline-3" id="outline-container-orga9e56f2">
<h3 id="orga9e56f2">Falcon</h3>
<div class="outline-text-3" id="text-orga9e56f2">
<p>
The <a href="http://websvn.kde.org/trunk/playground/bindings/krossfalcon/" target="_blank" rel="noopener">krossfalcon</a> plugin does implement access to <a href="http://www.falconpl.org" target="_blank" rel="noopener">The Falcon Programming Language</a>.
</p>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-org87b91ac">
<h2 id="org87b91ac">The Module plugins</h2>
<div class="outline-text-2" id="text-org87b91ac">
<p>
Modules are plugins loaded on demand at runtime to provide additional functionality. They only provide a factory to create and return a QObject instance that is then exposed to the scripting backend.
</p>
<p>
Since Qt's introspection functionality is used, we are able to throw in just <a href="https://doc.qt.io/qt-5/qobject.html" target="_blank" rel="noopener">QObject</a>'s and have them act as classes/objects within a scripting backend. Slots are membermethods while properties and enumerations are membervariables. If your application also likes to offer <a href="http://hal.freedesktop.org/wiki/Software/dbus" target="_blank" rel="noopener">D-Bus</a> support it may be an idea to reuse the <a href="https://doc.qt.io/qt-5/qdbusabstractadaptor.html" target="_blank" rel="noopener">QDBusAbstractAdaptor</a> implementations your application has also for scripting, like for
example <a href="file:///Development/Tutorials/KSpread_Scripting" target="_blank" rel="noopener">KSpread</a> did.
</p>
<p>
Let's take a look at the following code that implements the MyObject class which inherits from QObject;
</p>
<div class="org-src-container">
<pre class="src src-java"><span style="font-weight: bold;">class</span> <span style="font-weight: bold; text-decoration: underline;">MyObject</span> : <span style="font-weight: bold;">public</span> QObject {
  <span style="font-weight: bold; text-decoration: underline;">Q_OBJECT</span>
  <span style="font-weight: bold;">Q_PROPERTY</span>(QString name READ name <span style="font-weight: bold; text-decoration: underline;">WRITE</span> <span style="font-weight: bold; font-style: italic;">setName</span>)
  <span style="font-weight: bold;">public</span>:
    MyObject(QObject* parent = 0) : QObject(parent) {}
    virtual ~MyObject() {}
    <span style="font-weight: bold; text-decoration: underline;">QString</span> <span style="font-weight: bold;">name</span>() <span style="font-weight: bold;">const</span> { <span style="font-weight: bold;">return</span> objectName(); }
    <span style="font-weight: bold; text-decoration: underline;">void</span> <span style="font-weight: bold;">setName</span>(<span style="font-weight: bold;">const</span> <span style="font-weight: bold; text-decoration: underline;">QString</span>&amp; name) {
      <span style="font-weight: bold;">return</span> setObjectName(name);
    }
  <span style="font-weight: bold;">public</span> <span style="font-weight: bold; text-decoration: underline;">slots</span>:
    QObject* create(<span style="font-weight: bold;">const</span> <span style="font-weight: bold; text-decoration: underline;">QString</span>&amp; name,
                    QObject* parent=0) {
      MyObject* obj = <span style="font-weight: bold;">new</span> <span style="font-weight: bold; text-decoration: underline;">MyObject</span>(parent);
      obj-&gt;setObjectName(name);
      <span style="font-weight: bold;">return</span> obj;
    }
    QObject* parent() <span style="font-weight: bold;">const</span> { <span style="font-weight: bold;">return</span> QObject::parent(); }
    <span style="font-weight: bold; text-decoration: underline;">void</span> <span style="font-weight: bold;">setParent</span>(QObject* parent) {
      QObject::setParent(parent);
      <span style="font-weight: bold; text-decoration: underline;">emit</span> <span style="font-weight: bold;">parentChanged</span>(); 
    }
  <span style="font-weight: bold;">signals</span>:
    <span style="font-weight: bold; text-decoration: underline;">void</span> <span style="font-weight: bold;">parentChanged</span>();
};

extern <span style="font-style: italic;">"C"</span> {
  <span style="font-weight: bold; text-decoration: underline;">KDE_EXPORT</span> <span style="font-weight: bold;">QObject</span>* krossmodule() {
    <span style="font-weight: bold;">return</span> <span style="font-weight: bold;">new</span> <span style="font-weight: bold; text-decoration: underline;">MyObject</span>();
  }
}
</pre>
</div>
<p>
At the bottom the krossmodule() function will be called by Kross and returns an instance of MyObject that is then exposed to the scripting backend.
</p>
<p>
Then we just need to have our myobject.h and myobject.cpp files, filled with the content above, defined in the CMakeLists.txt file. The library needs to be named "krossmodule…" where the "…" is then the name the module is accessible as. For our example we use "krossmodulemyobjectmod" and therefore we are able to access the module if installed as "myobjectmod". The example does not depend on Kross, so you may like to replace ${KROSS_INCLUDES} with whatever else your module depends on. 
</p>
<pre class="example">
include_directories(${CMAKE_SOURCE_DIR}
  ${KROSS_INCLUDES})
set(krossmodulemyobjectmod_PART_SRCS
  myobject.cpp)
kde4_add_plugin(krossmodulemyobjectmod
  ${krossmodulemyobjectmod_PART_SRCS})
target_link_libraries(krossmodulemyobjectmod
  ${KDE4_KDECORE_LIBS} ${KDE4_KROSSCORE_LIBS})
install(TARGETS krossmodulemyobjectmod
  DESTINATION ${PLUGIN_INSTALL_DIR})
</pre>
<p>
The following Python sample code accesses then the module at runtime and uses the QObject, calls its slots and properties and connects a signal with a python function (e.g. save as file named "myobjecttest.py" and execute with "kross ./myobjecttest.py"); 
</p>
<pre class="example">
#!/usr/bin/env kross
import Kross
m = Kross.module("myobjectmod")
m.name = "MyObjectModuleName"
obj1 = m.create("OtherObjectName")
def myCallbackFunc(args):
    print "The parent of obj1 changed"
obj1.connect("parentChanged()",myCallbackFunc)
obj1.setParent(m)
print "%s %s" % (obj1.name,obj1.parent().name)
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-org6ddb8b4">
<h2 id="org6ddb8b4">Manager, GuiClient, Action</h2>
<div class="outline-text-2" id="text-org6ddb8b4">
<p>
The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/coremanager.h" target="_blank" rel="noopener">Kross::Manager</a> class is a singleton that provides access to the interpreters, to actions and to the modules. The Kross::Manager is available within scripting code as module named "Kross". Following Python script uses the Kross module to create a new Kross::Action instance, fills it with JavaScript code and executes that JavaScript code. 
</p>
<div class="org-src-container">
<pre class="src src-python"><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">!/usr/bin/env kross</span>
<span style="font-weight: bold;">import</span> Kross
<span style="font-weight: bold; font-style: italic;">a</span> = Kross.action(<span style="font-style: italic;">"MyKjsScript"</span>)
a.setInterpreter(<span style="font-style: italic;">"javascript"</span>)
a.setCode(<span style="font-style: italic;">"println(\"Hello world from Kjs\");"</span>)
a.trigger()
</pre>
</div>
<p>
The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/coreguiclient.h" target="_blank" rel="noopener">Kross::GuiClient</a> class implements KXMLGUIClient to provide GUI functionality, handling of XML configuration files on a more abstract level and offers some predefined actions that could be optionally used in your application.
</p>
<p>
The <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/coreaction.h" target="_blank" rel="noopener">Kross::Action</a> class offers an abstract container to deal with scripts like a single standalone scriptfile. Each action holds a reference to the by the matching <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/coreinterpreter.h" target="_blank" rel="noopener">Kross::Interpreter</a> instance created by <a href="https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kross/corescript.h" target="_blank" rel="noopener">Kross::Script</a> instance. Following Python script accesses the Kross module and the self variable which is our Kross::Action instance that provides the context for the running Python script. 
</p>
<div class="org-src-container">
<pre class="src src-python"><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">!/usr/bin/env kross</span>
<span style="font-weight: bold;">import</span> Kross
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"objectName=%s"</span> % Kross.objectName()
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"interpreters=%s"</span> % Kross.interpreters()
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"objectName=%s"</span> % <span style="font-weight: bold;">self</span>.objectName()
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"text=%s"</span> % <span style="font-weight: bold;">self</span>.text
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"enabled=%s"</span> % <span style="font-weight: bold;">self</span>.enabled
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"currentPath=%s"</span> % <span style="font-weight: bold;">self</span>.currentPath()
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"interpreter=%s"</span> % <span style="font-weight: bold;">self</span>.interpreter()
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"description=%s"</span> % <span style="font-weight: bold;">self</span>.description()
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"code=%s"</span> % <span style="font-weight: bold;">self</span>.code()
</pre>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-org2d54a61">
<h2 id="org2d54a61">D-Bus and Kross</h2>
<div class="outline-text-2" id="text-org2d54a61">
<p>
With the <a href="http://doc.trolltech.com/4.2/qtdbus.html" target="_blank" rel="noopener">QtDBus module</a> Qt provides a library that a Qt/KDE application is able to use to make Inter-Process Communication using the <a href="http://dbus.freedesktop.org/" target="_blank" rel="noopener">D-BUS protocol</a>.
</p>
<p>
The QtDBus module uses the Qt Signals and Slots mechanism. Applications that like to provide parts of their functionality to the D-Bus world are able to do so by implementing classes that inherit from the <a href="https://doc.qt.io/qt-5/qdbusabstractadaptor.html" target="_blank" rel="noopener">QDBusAbstractAdaptor</a> class.
</p>
<p>
Kross is able to reuse such by an application provided bindings. So, once your application supports D-Bus, Kross is able to reuse those already existing code and offers transparent access to the scripting-backends to them. How does this differ from e.g. the python-dbus package? Well, first method-calls don't go through the dbus-socket and then it's not dbus-related at all except, that we are able to reuse what your application offers anyway: a clean interface to the outside world. But that's not all, we are not limited to what's possible with D-Bus. We are also able to exchange instance-pointers to QObject or QWidget instances.
</p>
<p>
For an example you may like to take a look at how it was done in the Calligra Sheets <a href="https://projects.kde.org/projects/calligra/repository/revisions/master/entry/sheets/plugins/scripting/ScriptingModule.cpp" target="_blank" rel="noopener">ScriptingModule</a> class. 
</p>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="date">Date: 2020-6-3</p>
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer" target="_blank" rel="noopener">Validate</a></p>
</div>

      
    </div>

    
      

    

    <footer class="article-footer">
      <a data-url="http://gdme1320.gitee.com/linux/kross/kross/" data-id="cl13eo7n100fkhjv4vpsyrv94" class="article-share-link">
        <i class="fa fa-share"></i> Share
      </a>
      
      

    </footer>
  </div>
  
    
<ul id="article-nav" class="nav nav-pills nav-justified">
  
  <li role="presentation">
    <a href="/windows/openssh/" id="article-nav-older" class="article-nav-link-wrap">
      <i class="fa fa-chevron-left pull-left"></i>
      <span class="article-nav-link-title">Windows 10 OpenSSH</span>
    </a>
  </li>
  
  
  <li role="presentation">
    <a href="/linux/kross/ktorrent-scripts/ktorrent-scripts-and-information/" id="article-nav-newer" class="article-nav-link-wrap">
      <span class="article-nav-link-title">KTorrent scripts and information</span>
      <i class="fa fa-chevron-right pull-right"></i>
    </a>
  </li>
  
</ul>


  
</article>




        </div>
        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
          
  
  <div class="sidebar-module">
    <h4>Categories</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/apps/">apps</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/architecture/">architecture</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/">devops</a><span class="sidebar-module-list-count">10</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/kubectl/">kubectl</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/kubernetes/">kubernetes</a><span class="sidebar-module-list-count">3</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/dotnet/">dotnet</a><span class="sidebar-module-list-count">3</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/dotnet/entityframework/">entityframework</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/elasticsearch/">elasticsearch</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/emacs/">emacs</a><span class="sidebar-module-list-count">4</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/emacs/org-mode/">org-mode</a><span class="sidebar-module-list-count">3</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/git/">git</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/graphql/">graphql</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/groovy/">groovy</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/">java</a><span class="sidebar-module-list-count">52</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/concurrent/">concurrent</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/jackson/">jackson</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/shiro/">shiro</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring/">spring</a><span class="sidebar-module-list-count">11</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-amqp/">spring-amqp</a><span class="sidebar-module-list-count">5</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-amqp/spring-jpa/">spring-jpa</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-jpa/">spring-jpa</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-security/">spring-security</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/thymeleaf/">thymeleaf</a><span class="sidebar-module-list-count">2</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/thymeleaf/maven/">maven</a><span class="sidebar-module-list-count">1</span></li></ul></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/jenkins/">jenkins</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/journal/">journal</a><span class="sidebar-module-list-count">7</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/js/">js</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/">linux</a><span class="sidebar-module-list-count">35</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kde/">kde</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kross/">kross</a><span class="sidebar-module-list-count">3</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kross/ktorrent-scripts/">ktorrent-scripts</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/shell/">shell</a><span class="sidebar-module-list-count">6</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/tcp/">tcp</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/lisp/">lisp</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mongodb/">mongodb</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mssql/">mssql</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mysql/">mysql</a><span class="sidebar-module-list-count">12</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/nginx/">nginx</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/node/">node</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/postgresql/">postgresql</a><span class="sidebar-module-list-count">2</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/postgresql/client/">client</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/python/">python</a><span class="sidebar-module-list-count">19</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/regex/">regex</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/rfc/">rfc</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/vim/">vim</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/windows/">windows</a><span class="sidebar-module-list-count">7</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Tags</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/ReentrantLock/">ReentrantLock</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/nohup/">nohup</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/pandoc/">pandoc</a><span class="sidebar-module-list-count">1</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Tag Cloud</h4>
    <p class="tagcloud">
      <a href="/tags/ReentrantLock/" style="font-size: 10px;">ReentrantLock</a> <a href="/tags/nohup/" style="font-size: 10px;">nohup</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a>
    </p>
  </div>


  
  <div class="sidebar-module">
    <h4>Archives</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2919/06/">June 2919</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2022/03/">March 2022</a><span class="sidebar-module-list-count">58</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2022/01/">January 2022</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/11/">November 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/10/">October 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/04/">April 2021</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/03/">March 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/02/">February 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/01/">January 2021</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/12/">December 2020</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/11/">November 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/10/">October 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/09/">September 2020</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/07/">July 2020</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/06/">June 2020</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/04/">April 2020</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/03/">March 2020</a><span class="sidebar-module-list-count">8</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/02/">February 2020</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/01/">January 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/12/">December 2019</a><span class="sidebar-module-list-count">7</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/11/">November 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/10/">October 2019</a><span class="sidebar-module-list-count">11</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/09/">September 2019</a><span class="sidebar-module-list-count">6</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/08/">August 2019</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/07/">July 2019</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/06/">June 2019</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/05/">May 2019</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/04/">April 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/03/">March 2019</a><span class="sidebar-module-list-count">8</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/02/">February 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/01/">January 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/11/">November 2018</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/10/">October 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/08/">August 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/07/">July 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/06/">June 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/03/">March 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/07/">July 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/06/">June 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/04/">April 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2015/05/">May 2015</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/1970/01/">January 1970</a><span class="sidebar-module-list-count">9</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Recents</h4>
    <ul class="sidebar-module-list">
      
        <li>
          <a href="/java/acessing-generic-types-at-runtime/">获取泛型类型</a>
        </li>
      
        <li>
          <a href="/linux/shell/bash_cgi/">Script for Shell Parsing Parameters</a>
        </li>
      
        <li>
          <a href="/linux/shell/shell-script/">Shell Script Getting Start</a>
        </li>
      
        <li>
          <a href="/linux/tcp/network-tcp-performance-turning-with-sysctl/">【翻译】Sysctl调节Linux网络性能</a>
        </li>
      
        <li>
          <a href="/java/concurrent/aqs-src/">AQS源码笔记</a>
        </li>
      
    </ul>
  </div>



        </div>
    </div>
  </div>
  <footer class="blog-footer">
  <div class="container">
    <div id="footer-info" class="inner">
      &copy; 2022 gdme1320<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

  

<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script> -->

<script src="/js/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>



<script src="/js/script.js"></script>

</body>
</html>
